// XtremeDialog.cpp : implementation file
//

#include "stdafx.h"
#include "XtremeFrame.h"
#include "XtremeDialog.h"
#include "afxdialogex.h"


// CXtremeDialog dialog

IMPLEMENT_DYNAMIC(CXtremeDialog, CDialog)

CXtremeDialog::CXtremeDialog(UINT nIDTemplate,CWnd* pParent /*=NULL*/)
	: CDialog(nIDTemplate, pParent)
{

	TCHAR szStylesPath[_MAX_PATH];

	VERIFY(::GetModuleFileName(
		AfxGetApp()->m_hInstance, szStylesPath, _MAX_PATH));		
	
	m_strStylesPath = szStylesPath;
	int nIndex  = m_strStylesPath.ReverseFind(_T('\\'));
	if (nIndex > 0) {
		m_strStylesPath = m_strStylesPath.Left(nIndex);
	}
	else {
		m_strStylesPath.Empty();
	}
	m_strStylesPath += _T("\\Styles\\");
	XTPSkinManager()->SetApplyOptions(XTPSkinManager()->GetApplyOptions() | xtpSkinApplyMetrics);
	XTPSkinManager()->LoadSkin(m_strStylesPath + _T("Vista.cjstyles"), _T("NormalBlack2.ini"));	

}

CXtremeDialog::~CXtremeDialog()
{
}

void CXtremeDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CXtremeDialog, CDialog)
END_MESSAGE_MAP()


// CXtremeDialog message handlers


BOOL CXtremeDialog::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}


// VisualTheme
void CXtremeDialog::VisualTheme(int visualtheme)
{
	switch (visualtheme)
	{	
		case 0:
			XTPSkinManager()->LoadSkin(m_strStylesPath + _T("WinXP.Luna.cjstyles"));	
			break;
		case 2:
			XTPSkinManager()->LoadSkin(m_strStylesPath + _T("WinXP.Royale.cjstyles"));	
			break;
		case 3:
			XTPSkinManager()->LoadSkin(m_strStylesPath + _T("Office2007.cjstyles"));	
			break;
		case 4:
			XTPSkinManager()->LoadSkin(m_strStylesPath + _T("Vista.cjstyles"));	
			break;

		default:
			XTPSkinManager()->LoadSkin(_T(""), _T(""));	
			break;
	}

	RedrawWindow(0, 0, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ALLCHILDREN);
}
